import 'extended_infos.dart';
import 'periods.dart';
import 'result.dart';

class Competition {
  ExtendedInfos? extendedInfos;
  // Periods? periods;
  List<Result>? result;

  Competition({this.extendedInfos, this.result});

  factory Competition.fromJson(Map<String, dynamic> json) => Competition(
        extendedInfos: json['ExtendedInfos'] == null
            ? null
            : ExtendedInfos.fromJson(
                json['ExtendedInfos'] as Map<String, dynamic>),
        // periods: json['Periods'] == null
        //     ? null
        //     : Periods.fromJson(json['Periods'] as Map<String, dynamic>),
        result: (json['Result'] as List<dynamic>?)
            ?.map((e) => Result.fromJson(e as Map<String, dynamic>))
            .toList(),
      );

  Map<String, dynamic> toJson() => {
        'ExtendedInfos': extendedInfos?.toJson(),
        // 'Periods': periods?.toJson(),
        'Result': result?.map((e) => e.toJson()).toList(),
      };
}
